package svc

import (
	"github.com/zeromicro/go-zero/zrpc"
	"grpc-common/ucenter/ucclient"
	"ucenter-api/internal/config"
)

type ServiceContext struct {
	Config        config.Config
	UCRegisterRpc ucclient.Register //上下文, 添加生成的.go文件中的, 顶层接口类型
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config: c,
		//zrpc.MustNewClient(c.UCenterRpc):根据配置文件的地址, 创建ucenter的客户端      ucclient.NewRegister:是公共模块.go文件的
		UCRegisterRpc: ucclient.NewRegister(zrpc.MustNewClient(c.UCenterRpc)),
	}
}
